<?php
/**
 * 上下架记录模型
 * @author sundongdong
 * @date 2016-07-11
 */
class Interface_Model_Upshelf extends Model_Base {
	/**
	 * 批量添加上下架记录
	 * @param unknown $data
	 */
	public function add($data) {
		try {
			$this->db('write_db')->beginTransaction();
			$betch = array();
			foreach ($data as $v) {
				$betch[] = array(
					'goods_sn' => $v['goods_sn'],
					'web_site' => $v['website'],
					'up_time' => $v['syn_time'],
					'add_user' => $v['syn_user'],
					'create_time' => date('Y-m-d H:i:s'),
					'type' => $v['is_on_sale']
				);
			}
			$this->insertBatch($this->db('write_db'), 'web_up_shelf', $betch);
			$this->db('write_db')->commit();
			return array('opr'=>1, 'data'=> 'success');
		} catch (Exception $e) {
			$this->db('write_db')->rollBack();
			return array('opr'=>0, 'data'=>$e->getMessage());
		}
	}
}